import { createRouter, createWebHistory, RouteRecordRaw,createWebHashHistory } from 'vue-router'
import defaultPages from './defaultRouter'
const routes: Array<RouteRecordRaw> = [
    {
        path: '/',
        name: "index",
        component: () => import('../layout/layout.vue'),
        redirect: "/home",
        children: [
            {
                path: 'home',
                name: 'home',
                component: () => import("../views/home.vue"),
                meta: {
                    keepAlive: true,
                    level: 1,
                    transitionName: "",
                    name:"主页"
                },
            },
            {
                path: 'article/:id',
                name: 'article',
                component: () => import("../views/article.vue"),
                meta: {
                    keepAlive: true,
                    level: 2,
                    transitionName: "",
                    name:"详情"
                },
            }
        ]
    },
    {
        path: '/about',
        name: "about",
        component: () => import("../views/about.vue"),
        meta: {
            keepAlive: true,
            level: 2,
            transitionName: ""
        }
    },
    {
        path: "/login",
        name: "login",
        component: () => import('../views/login.vue'),
        meta:{
            name:"登录"
        }
    },
    {
        path: "/admin",
        name: "admin",
        redirect: "/admin/dashboard",
        component: () => import('../layout/admin/main.vue'),
        children: [

            ...defaultPages
            // {
            //     path: 'dashboard',
            //     name: "dashboard",
            //     component: () => import('../views/dashboard.vue'),
            //     meta:{
            //         name:"仪表盘",
            //         keepAlive:true,
            //     }
            // },
            // {
            //     path: 'public',
            //     name: "public",
            //     component: () => import('../views/public.vue'),
            //     meta:{
            //         name:"我的发表",
            //         keepAlive:true,
            //     }
            // },
            // {
            //     path: 'comment',
            //     name: "comment",
            //     component: () => import('../views/comment.vue'),
            //     meta:{
            //         name:"我的评论",
            //         keepAlive:true,
            //     }
            // },
            // {
            //     path: 'profile',
            //     name: "profile",
            //     component: () => import('../views/profile.vue'),
            //     meta:{
            //         name:"我的资料",
            //         keepAlive:true,
            //     }
            // },
            // {
            //     path: 'notify',
            //     name: "notify",
            //     component: () => import('../views/notify.vue'),
            //     meta:{
            //         name:"消息",
            //         keepAlive:true,
            //     }
            // }
        ]
    },
    // {
    //     path: "/:pathMatch(.*)",
    //     name: "404",
    //     component: () => import("../views/404.vue"),
    // },
]



const router = createRouter({
    history: createWebHashHistory(),
    routes,
    strict: true,
    scrollBehavior: () => ({ left: 0, top: 0 }),
})

export default router;